<template>
	<view class="box">
		<view class="navBox">
			<fui-tabs :tabs="tabs" @change="tabChange" :current="tabIndex" selectedColor="#000" :short="false"
				background="none" />
		</view>
		<view class="listBox">
			<swiper :current="tabIndex" :duration="300" @change="tabChange" class="swiper">
				<swiper-item class="fui-swiper__item" v-for="(res,inx) in tabs" :key="inx">
					<scroll-view scroll-y :show-scrollbar="false" class="swiper">
						<view class="goods">
							<view class="goodsBox" v-for="(item,index) in 9" :key="index" @click="toGoodsDetails">
								<view class="flex">
									<view class="imgBox">
										<image src="../../static/test/userheader.jpg" mode="aspectFill"></image>
									</view>
									<view class="copywriting">
										啊收到了喀什觉得按时打卡是打开奥斯卡德拉克斯觉得啊啊啊啊啊
									</view>
									<view class="" style="color: #C4516E;width: 20%;">
										<text style="font-size:26rpx ;">￥</text><text>1</text>
									</view>
								</view>
								<view class="money flex">
									<view class="btnBox">
										联系买家
									</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>



	</view>
</template>

<script>
	export default {

		data() {
			return {
				tabIndex: 0,
				tabs: [
					'全部',
					'待付款',
					'待发货',
					'已发货',
					'已结束',
				],
			};
		},
		destroyed() {
			console.log('beforeDestroy');
			// this.list.map(v => {
			// 	let video = uni.createVideoContext(v.id, this);
			// 	video.seek(1);
			// 	video.pause();
			// })
		},
		methods: {
			toGoodsDetails() {
				uni.navigateTo({
					url: '/myPages/DeliverGoods/OrderDetails'
				})
			},
			tabChange(e) {
				if (e.name) {
					this.switchTab(e.index);
				} else {
					if (e.detail.source == 'touch') {
						let index = e.target.current || e.detail.current;
						this.switchTab(index);
					}
				}

			},
			switchTab(index) {
				if (this.tabIndex === index) return;
				this.tabIndex = index;
			},
			toDetails() {
				uni.navigateTo({
					url: '/myPages/userDetails'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	view {
		box-sizing: border-box;
	}

	.listBox {
		height: calc(100vh - 100rpx);
	}

	.navBox {
		height: 100rpx;
		background-color: white;
	}

	.box {
		height: 100vh;
	}

	.swiper {
		height: 100%;
	}

	.btnBox {
		font-size: 26rpx;
		margin-left: 20rpx;
		background-color: #F8F8F8;
		padding: 8rpx 25rpx;
		border-radius: 20rpx;
	}

	.videoBox {
		width: 100%;
		height: 100%;
	}

	.goodsBox {
		padding: 20rpx;
		margin-bottom: 20rpx;
		width: 100%;
		border-radius: 25rpx;
		background-color: white;
	}

	.goods {
		padding: 20rpx;
		width: 100%;
	}

	.imgBox {
		width: 150rpx;
		border-radius: 25rpx;

		image {
			border-radius: 25rpx;
			width: 150rpx;
			height: 150rpx;
		}
	}

	.money {
		margin-top: 20rpx;
		justify-content: flex-end;
	}

	.copywriting {
		font-size: 26rpx;
		padding: 0rpx 20rpx;
		overflow: hidden;
		display: -webkit-box;
		-webkit-box-orient: vertical;

		text-overflow: ellipsis;
		word-break: break-all;
		-webkit-line-clamp: 2;
	}
</style>